import 'package:flutter/material.dart';
import 'package:flutter_sample/pages/dart/emp_button_page.dart';
import 'package:flutter_sample/pages/dart/flex_page_with_savearea.dart';
import 'package:flutter_sample/pages/dart/gesture_demo.dart';
import 'package:flutter_sample/pages/dart/gridview_demo.dart';
import 'package:flutter_sample/pages/dart/key_press_page.dart';
import 'package:flutter_sample/pages/dart/system_channel_page.dart';
import 'package:flutter_sample/pages/texture/picture_list_page.dart';
import 'package:go_router/go_router.dart';

import 'common/beans.dart';
import 'pages/animations/animate0.dart';
import 'pages/animations/animate1.dart';
import 'pages/animations/animate2.dart';
import 'pages/animations/animate3.dart';
import 'pages/animations/animate4.dart';
import 'pages/animations/animate5.dart';
import 'pages/animations/container.dart';
import 'pages/animations/hero_animation.dart';
import 'pages/animations/hero_animation_basic.dart';
import 'pages/animations/menu_anim.dart';
import 'pages/animations/opcity_anim.dart';
import 'pages/animations/pate_animate.dart';
import 'pages/animations/physics_card_drag_demo.dart';
import 'pages/animations/radio_hero_animation.dart';
import 'pages/animations/radio_hero_animation_animate_rectclip.dart';
import 'pages/animations/radio_hero_animation_basic.dart';
import 'pages/animations/stagger_anim.dart';
import 'pages/dart/expanded_page.dart';
import 'pages/dart/flex_page.dart';
import 'pages/dart/gif_test_page.dart';
import 'pages/dart/my_custom_form.dart';
import 'pages/dart/no_appbar_page.dart';
import 'pages/dart/pull_list_page.dart';
import 'pages/home_page.dart';
import 'pages/jsbridge/webpage.dart';
import 'pages/jsbridge/webpage2.dart';
import 'pages/jsbridge/webpage3.dart';
import 'pages/jsbridge/webpage4.dart';
import 'pages/jsbridge/webpage5.dart';
import 'pages/jsbridge/webpage6.dart';
import 'pages/jsbridge/webview_page.dart';
import 'pages/dart/read_data_page.dart';
import 'pages/paint_page.dart';
import 'pages/plugin_page.dart';
import 'pages/string_list_page.dart';
import 'pages/texture/CustomPage.dart';
import 'pages/texture/PicturePage.dart';
import 'pages/texture/video_page.dart';
import 'pages/texture/video_tab_page.dart';

List<ScreenBean> pages = [
  ScreenBean('GifTestPage', const GifTestPage()),
  ScreenBean("InputPage", const InputPage()),
  ScreenBean("InputPage2,自动获取焦点", const InputPage2()),
  ScreenBean("GestureDemo", const GestureDemo()),
  ScreenBean("GridViewDemo", const GridViewDemo()),
  ScreenBean("PullListPage,外接纹理", const PullListPage(title: "PullListPage"), true),
  ScreenBean("KeyPressPage", const KeyPressPage()),
  ScreenBean("ExpandedPage", const ExpandedPage()),
  ScreenBean("SystemChannelPage", const SystemChannelPage()),
  ScreenBean("FlexPage", const FlexPage()),
  ScreenBean("FlexPageWithSafeArea", const FlexPageWithSafeArea()),
  ScreenBean("CustomPage,外接纹理", const CustomPage()),
  ScreenBean("PicturePage,外接纹理", const PicturePage(), true),
  ScreenBean("PictureListPage,外接纹理", PictureListPage(), true),
  ScreenBean("AssetVideoPage1,外接纹理", const AssetVideoPage("assets/videos/trailer.mp4"), true),
  ScreenBean("AssetVideoPage2,外接纹理", const AssetVideoPage("assets/videos/register.mp4"), true),
  ScreenBean("VideoTabPage,外接纹理", const VideoTabPage(), true),
  ScreenBean("WebPage,外接纹理", const WebPage()),
  ScreenBean("WebPage2,不带滚动条", const WebPage2()),
  ScreenBean("WebPage3,全屏显示", const WebPage3()),
  ScreenBean("WebPage4,加载指定网页", const WebPage4()),
  ScreenBean("WebPage5", const WebPage5()),
  ScreenBean("WebPage6", const WebPage6()),
  ScreenBean("WebViewPage,", const WebViewPage()),
  ScreenBean("MyCustomForm", const MyCustomForm()),
  ScreenBean("ReadDataPage", const ReadDataPage()),
  ScreenBean("PluginPage", const PluginPage()),
  ScreenBean("NoAppBarPage", const NoAppBarPage(), true),
  ScreenBean("EMPButtonTestPage", const EMPButtonTestPage()),
  ScreenBean("PaintPage", const PaintPage()),
  ScreenBean("StringListPage", const StringListPage()),
  ScreenBean("LogoApp", const LogoApp()),
  ScreenBean("LogoApp1", const LogoApp1()),
  ScreenBean("LogoApp2", const LogoApp2()),
  ScreenBean("LogoApp3", const LogoApp3()),
  ScreenBean("LogoApp4", const LogoApp4()),
  ScreenBean("LogoApp5", const LogoApp5()),
  ScreenBean("AnimatedContainerApp", const AnimatedContainerApp(), true),
  ScreenBean("OpcityPage", const OpcityPage(title: "OpcityPage"), true),
  ScreenBean("PageAnimateHome", const PageAnimateHome(), true),
  ScreenBean("PhysicsCardDragDemo", const PhysicsCardDragDemo(), true),
  ScreenBean("StaggerDemo", const StaggerDemo(), true),
  ScreenBean(
    "ExampleStaggeredAnimations",
    const MaterialApp(
      home: ExampleStaggeredAnimations(),
      debugShowCheckedModeBanner: false,
    ),
  ),
  ScreenBean("HeroBasicAnimation", const HeroBasicAnimation(), true),
  ScreenBean("HeroAnimation", const HeroAnimation(), true),
  ScreenBean(
      "RadialExpansionBasicDemo", const RadialExpansionBasicDemo(), true),
  ScreenBean("RadialExpansionDemo", const RadialExpansionDemo(), true),
  ScreenBean(
      "RadialExpansionRectclipDemo", const RadialExpansionRectclipDemo(), true),
];

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerConfig: GoRouter(
        routes: [
          GoRoute(
            path: '/',
            builder: (_, __) => HomePage(pages: pages),
            routes: pages
                .map(
                  (item) => GoRoute(
                    path: item.path,
                    builder: (_, __) => item.screen,
                  ),
                )
                .toList(),
          ),
        ],
      ),
    );
  }
}
